package com.hope;

import android.app.IntentService;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;

public class AlarmService extends IntentService {
	
	private NotificationManager mNotificationManager;
    NotificationCompat.Builder builder;
    public static final int NOTIFICATION_ID = 1;
	
	public AlarmService(){
		super("HopeAlarmService");
	}
	
	@Override
	protected void onHandleIntent(Intent intent){
		
		String msg = "It it time to take your medication.";
		
		mNotificationManager = (NotificationManager)
	           this.getSystemService(Context.NOTIFICATION_SERVICE);
	
	    PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
	        new Intent(this, MainActivity.class), 0);
		
	    NotificationCompat.Builder mBuilder =
	    		new NotificationCompat.Builder(this)
	    .setSmallIcon(R.drawable.ic_launcher)
        .setContentTitle(getString(R.string.alarm_alertTitle))
        .setStyle(new NotificationCompat.BigTextStyle()
        .bigText(msg))
        .setContentText(msg);
	    
	    mBuilder.setContentIntent(contentIntent);
        mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
	}

}
